import { PureComponent } from 'react'
import { Divider, Select, Button, Input, DatePicker } from 'antd'
import CollectionListModal from 'components/modal/collectionListModal'
import SingleTable from 'components/table/index'
import styles from './collectionList.less'
const { Option } = Select
const { RangePicker } = DatePicker
export default class CollectionList extends PureComponent {
    state = {
        visible: false
    }
    handleOk = () => {
        this.setState({ visible: false})
    }
    handleCancel = () => {
        this.setState({ visible: false})
    }
    renderMdal(){
        const { visible } = this.state
        return(
            <CollectionListModal
                visible={visible}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
            />
        )
    }
    handleAdd = () => {
        this.setState({visible: true })
    }
    render(){
        const dataList = []
        const columns = [
        {
            key: 'gmtCreate',
            title: '转运单号',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: 'operationTypeName',
            title: '支付方式',
            dataIndex: 'operationTypeName',
            align: 'center',
        },
        {
            key: 'creatorName',
            title: '金额',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '1',
            title: '货币',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '2',
            title: '汇率',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '3',
            title: '应收金额',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '4',
            title: '操作人',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '5',
            title: '汇款时间',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '6',
            title: '创建时间',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: '8',
            title: '操作',
            dataIndex: 'creatorName',
            align: 'center',
            render: (text, record) => (
                <span>
                  <a >编辑</a>
                  <Divider type="vertical" />
                  <a >删除</a>
                </span>
            ),
        },
        
        ]
        return(
            <div className={styles.collectionList}>
                <div className={styles.collectionBox}>
                    <h2>汇率管理</h2>
                </div>
                <div className={styles.collectionSearch}>
                    <div className={styles.collectionSin}>
                        <span className={styles.collectionSpan}>支付方式：</span>
                        <Select className={styles.collectionInput}>
                            <Option value="lovely">Lovely</Option>
                        </Select>
                    </div>
                    <div className={styles.collectionSin} style={{margin: '0 28px'}}>
                        <span className={styles.collectionSpan}>转运单号：</span>
                        <Input className={styles.collectionInput}/>
                    </div>
                    <div className={styles.collectionSin} style={{marginRight: '28px'}}>
                        <span className={styles.collectionSpan}>流水号：</span>
                        <Input className={styles.collectionInput}/>
                    </div>
                </div>
                <div className={styles.collectionSearch}>
                    <div className={styles.collectionSin}>
                        <span className={styles.collectionSpan}>汇款时间：</span>
                       <RangePicker className={styles.collectionInput} style={{width: '280px'}}/>
                    </div>
                    <div className={styles.collectionSin} style={{marginLeft: '48px'}}>
                        <span className={styles.collectionSpan}>创建时间：</span>
                       <RangePicker className={styles.collectionInput} style={{width: '280px'}}/>
                    </div>
                    
                </div>
                <Button type="primary" icon="search" style={{margin: '0 0 24px 24px'}}>查询</Button>
                <Button  icon="plus" style={{marginLeft: '24px'}} onClick={this.handleAdd}>新建</Button>
                <div className={styles.collectionTable}>
                    <SingleTable
                        data={{ list: dataList }}
                        columns={columns}
                    />
                </div>
                {this.renderMdal()}
            </div>
        )
    }
}